<!--
 /**
 * Author: hongChengHao
 * Date: 2022-07-26 14:44
 * Desc: 性别弹窗 SexPop
 */
-->
<template>
  <view class="sex-pop">
    <zm-popup-picker
      v-model="currentValue"
      :list="list"
      @confirm="onSave"
      val-key="id"
      :check-val="obj.sex"
    ></zm-popup-picker>
  </view>
</template>
<script>
  import ZmPopupPicker from '@/commons/ZmPopupPicker'
  export default {
    name: 'SexPop',
    components: { ZmPopupPicker },
    props: {
      value: {
        type: Boolean,
        default: false
      },
      obj: {
        type: Object,
        default: () => {
          return {}
        }
      }
    },
    data() {
      return {
        list: [
          {
            id: '2',
            name: '女'
          },
          {
            id: '1',
            name: '男'
          }
        ]
      }
    },
    methods: {
      onSave({ id }) {
        this.$emit('setMemberData', { sex: id })
        // this.onClose()
      },
      onClose() {
        this.$emit('input', false)
      }
    },
    computed: {
      currentValue: {
        get() {
          return this.value
        },
        set(v) {
          this.$emit('input', v)
        }
      }
    }
  }
</script>
